<?php
//设置当前页面字符集为utf8
//header("content-type:text/html;charset=utf8");

/**
 * PHP文件插入header("Content-type: text/html; charset=utf-8");
 * 相当于页面里面的<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 */
 

$db_host 	= "localhost";
$db_user 	= "root";
$db_pwd 	= "root";
$db_name 	= "saixinjituan";
$db_prefix	= "007_"; 

//包含相关文件
//require("functions.php");
//连接数据库
			//表前缀
$link = mysqli_connect($db_host,$db_user,$db_pwd,$db_name);
mysqli_query($link,"set names utf8");

if($link){
	//echo '1111111';
	$sql = "select * from {$db_prefix}site where id=1";
	$result = mysqli_query($link,$sql);
	while($row = mysqli_fetch_assoc($result)){
		//var_dump(json_encode($row));
		//echo json_encode($row);
		//$SiteList=$row;
		//echo $row;
		var_dump($row);
		$SiteList=$row;
		
		$SiteList1=json_encode($row);
		
	}
//	class Web(){
//		public $webname="dadad";
//		public keywords
//	}
	//$SiteList=
	//$SiteList = array('east'=>'tiger','north'=>'wolf','duck','south'=>'monkey');
	echo $SiteList['id'].$SiteList['description'];
	echo  $SiteList1;
}
$onmouseover="onmouseout=this.style.backgroundColor='' onmouseover=this.style.backgroundColor='#f6f6f6'";



/**
 * 检查数据库连接信息
 */
function getLink($db_host,$db_user,$db_pwd,$db_name)
{
	//连接MySQL数据库
	$link = mysqli_connect($db_host,$db_user,$db_pwd,$db_name);   //
	if(!$link)
	{
		echo "<li>连接MySQL出错了，请检查数据库配置信息！</li>";
		exit();
		
		/**
		 * exit() 函数输出一条消息，并退出当前脚本。该函数是 die() 函数的别名。
		 */
	}
	//选择当前数据库
	if(!mysqli_select_db($link,($db_name)))
	{
		echo "<li>选择MySQL出错了，请检查数据库配置信息！</li>";
		exit();
	}
	//设置当前字符集
	mysqli_query($link,"set names utf8");
	
	//如果数据库连接成功，返回连接标识
	
	return ;
}

	
//				$link = mysqli_connect($db_host,$db_user,$db_pwd,$db_name);
//				$sql = "select * from {$db_prefix}news order by orderby asc,id desc limit 0,8";
//				//echo $sql;
//				mysqli_query($link,"set names utf8");
//				$result = mysqli_query($link,$sql);
//				echo $sql;
//				echo "<pre>";
//				echo $sql,"<br/>";
//				echo json_encode($result);
//				while($row = mysqli_fetch_assoc($result)){
//					var_dump(json_encode($row));
//					$json=json_encode($row);
//					?>
					<!--<script>
						//console.log(eval(
						<?php 
						//echo $json 
						?>
						// )) 
						</script>-->

					<?php
//					//echo $result;
//				}
//				echo "</pre>";
				
				//【对象生成json信息】
 class Person{
    public $addr = "beijing";
    public $height = 170;
     public function study(){
         echo "study php";
     }
 }
 $tom = new Person();
 //只是对象的属性给生成json信息
 //echo json_encode($tom);//{"addr":"beijing","height":170}
 //$tom.study();
 //new Person().study();
				
				
//				$pd='{"id":"179","cat":"0","title":"Welcome to Beijing","author":"admin","source":"saixinjituan","keywords":"sdfs","description":"sdf","orderby":"50","content":"dsfsd","hits":"0","addate":"1397656651"}'
//				var_dump(json_encode($pd));
					
				

?>